follow-up r88171 - fix fatal if suggested filename has illegal character in it.
authorBrian Wolff <bawolff@users.mediawiki.org>
Tue, 16 Aug 2011 05:37:18 +0000 (05:37 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Tue, 16 Aug 2011 05:37:18 +0000 (05:37 +0000)
Check to make sure the title object actual exists, before checking its namespace,
since alll the does this have illegal chars check is done after the does it
start with file: check.

For future note though, when using upload by url feature, the suggested
destination name when you put http://upload.wikimedia.org/wikipedia/commons/e/e0/Petrorhagia_prolifera_%281%29.JPG is illegal, which is probably not very user-friendly (filed as bug 30390)

includes/upload/UploadBase.php

index 78f5d66..429a363 100644 (file)
@@ -611,7 +611,7 @@ abstract class UploadBase {
                 * and that the namespace prefix needs to be stripped of.
                 */
                $title = Title::newFromText( $this->mDesiredDestName );
-               if ( $title->getNamespace() == NS_FILE ) {
+               if ( $title && $title->getNamespace() == NS_FILE ) {
                        $this->mFilteredName = $title->getDBkey();
                } else {
                        $this->mFilteredName = $this->mDesiredDestName;